// 商品表
const {DataTypes, db } = require("../db");
db.define('goods', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,allowNull:false,comment:'租户ID'}, 
categoryId:{type: DataTypes.SMALLINT,defaultValue:0,comment:'商品分类ID'}, 
name:{type: DataTypes.STRING(150),allowNull:false,comment:'商品名称'}, 
pinYin:{type: DataTypes.STRING(100),defaultValue:(''),comment:'拼音'}, 
code:{type: DataTypes.STRING(50),defaultValue:(''),comment:'商品编号'}, 
spec:{type: DataTypes.INTEGER,allowNull:false,defaultValue:1,comment:'规格,换算系数'}, 
barCode:{type: DataTypes.STRING(60),defaultValue:(''),comment:'条码'}, 
unit1:{type: DataTypes.STRING(10),allowNull:false,defaultValue:(''),comment:'单位名称'}, 
unit1Id:{type: DataTypes.INTEGER,allowNull:false,comment:'单位名称ID'},
unit2:{type: DataTypes.STRING(6),defaultValue:(''),comment:'零售单位名称'},
unit2Id:{type: DataTypes.INTEGER,comment:'零售单位名称ID'},
price1:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'预计采购价，商品无成本则取这个价格为商品成本'},
price2:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'预计销售价'}, 
lowQty:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'最小库存'}, 
highQty:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'最大库存'}, 
vol:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'容量'}, 
length:{type: DataTypes.INTEGER,defaultValue:0,comment:'长'}, 
width:{type: DataTypes.INTEGER,defaultValue:0,comment:'宽'}, 
height:{type: DataTypes.INTEGER,defaultValue:0,comment:'高'}, 
weight:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'重'}, 
wrapperId:{type: DataTypes.INTEGER,defaultValue:0,comment:'包装物类的商品ID'}, 
safeDays:{type: DataTypes.INTEGER,defaultValue:0,comment:'安全库存天数'}, 
disabled:{type: DataTypes.TINYINT,defaultValue:0,comment:'0启用   1禁用'}, 
isDel:{type: DataTypes.INTEGER,defaultValue:0,comment:''}, 
imgUrl:{type: DataTypes.STRING(255),defaultValue:(''),comment:'图片地址'}, 
cby:{type: DataTypes.INTEGER,defaultValue:0,comment:''}, 
ctime:{type: DataTypes.STRING(20),defaultValue:(''),comment:''}, 
uby:{type: DataTypes.INTEGER,defaultValue:0,comment:''}, 
utime:{type: DataTypes.STRING(20),defaultValue:(''),comment:''}, 
dby:{type: DataTypes.INTEGER,defaultValue:0,comment:''}, 
dtime:{type: DataTypes.STRING(20),defaultValue:(''),comment:''}, 
isDelete:{type: DataTypes.TINYINT,defaultValue:0,comment:'0正常  1删除'}, 
isAutoBackGood:{type: DataTypes.INTEGER,defaultValue:0,comment:'扫码自动退货商品'}, 
createdAt:{type: DataTypes.STRING(20),defaultValue:(''),comment:'创建时间'},
inShop:{type: DataTypes.INTEGER,defaultValue:1,comment:'电商 上架 0|1'}, 
categoryName:{type: DataTypes.STRING(255),defaultValue:(''),comment:'分类名称'}, 
barCode1:{type: DataTypes.STRING(60),comment:''}, 
imgUrl1:{type: DataTypes.STRING(255),comment:'小单位图片'}, 
hjId:{type: DataTypes.INTEGER,comment:'货架ID'}, 
brandId:{type: DataTypes.INTEGER,comment:'品牌ID'},
sendPrice:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'赠品兑换单价'},
}, {
    tableName: 'goods',
    timestamps: false,
    comment: '商品表',
    indexes:[{"unique":true,"name":"商品名称唯一","fields":["tenantId"," name"]}]
});